{
Created: Wednesday, September 7, 1988 at 2:38 PM
    Windows.p
    Pascal Interface to the Macintosh Libraries

    Copyright Apple Computer, Inc.  1985-1988
    All rights reserved
}


{$IFC UNDEFINED UsingIncludes}
{$SETC UsingIncludes := 0}
{$ENDC}

{$IFC NOT UsingIncludes}
    UNIT Windows;
    INTERFACE
{$ENDC}

{$IFC UNDEFINED UsingWindows}
{$SETC UsingWindows := 1}

{$I+}
{$SETC WindowsIncludes := UsingIncludes}
{$SETC UsingIncludes := 1}
{$IFC UNDEFINED UsingQuickdraw}
{$I $$Shell(PInterfaces)Quickdraw.p}
{$ENDC}
{$IFC UNDEFINED UsingEvents}
{$I $$Shell(PInterfaces)Events.p}
{$ENDC}
{$IFC UNDEFINED UsingControls}
{$I $$Shell(PInterfaces)Controls.p}
{$ENDC}
{$SETC UsingIncludes := WindowsIncludes}

CONST
documentProc = 0;
dBoxProc = 1;
plainDBox = 2;
altDBoxProc = 3;
noGrowDocProc = 4;
zoomDocProc = 8;
zoomNoGrow = 12;
rDocProc = 16;
dialogKind = 2;
userKind = 8;

{ FindWindow Result Codes }

inDesk = 0;
inMenuBar = 1;
inSysWindow = 2;
inContent = 3;
inDrag = 4;
inGrow = 5;
inGoAway = 6;
inZoomIn = 7;
inZoomOut = 8;

{ window messages }

wDraw = 0;
wHit = 1;
wCalcRgns = 2;
wNew = 3;
wDispose = 4;
wGrow = 5;
wDrawGIcon = 6;

{ defProc hit test codes }

wNoHit = 0;
wInContent = 1;
wInDrag = 2;
wInGrow = 3;
wInGoAway = 4;
wInZoomIn = 5;
wInZoomOut = 6;
deskPatID = 16;

{ Window Part Identifiers which correlate color table entries with window elements }

wContentColor = 0;
wFrameColor = 1;
wTextColor = 2;
wHiliteColor = 3;
wTitleBarColor = 4;


TYPE


WStateData = RECORD
    userState: Rect;            {user state}
    stdState: Rect;             {standard state}
    END;

AuxWinPtr = ^AuxWinRec;
AuxWinHndl = ^AuxWinPtr;
AuxWinRec = RECORD
    awNext: AuxWinHndl;         {handle to next AuxWinRec}
    awOwner: WindowPtr;         {ptr to window }
    awCTable: CTabHandle;       {color table for this window}
    dialogCItem: Handle;        {handle to dialog manager structures}
    awFlags: LONGINT;           {reserved for expansion}
    awReserved: CTabHandle;     {reserved for expansion}
    awRefCon: LONGINT;          {user Constant}
    END;

WCTabPtr = ^WinCTab;
WCTabHandle = ^WCTabPtr;
WinCTab = RECORD
    wCSeed: LONGINT;            {reserved}
    wCReserved: INTEGER;        {reserved}
    ctSize: INTEGER;            {usually 4 for windows}
    ctTable: ARRAY [0..4] OF ColorSpec;
    END;

WindowPeek = ^WindowRecord;
WindowRecord = RECORD
    port: GrafPort;
    windowKind: INTEGER;
    visible: BOOLEAN;
    hilited: BOOLEAN;
    goAwayFlag: BOOLEAN;
    spareFlag: BOOLEAN;
    strucRgn: RgnHandle;
    contRgn: RgnHandle;
    updateRgn: RgnHandle;
    windowDefProc: Handle;
    dataHandle: Handle;
    titleHandle: StringHandle;
    titleWidth: INTEGER;
    controlList: ControlHandle;
    nextWindow: WindowPeek;
    windowPic: PicHandle;
    refCon: LONGINT;
    END;

CWindowPeek = ^CWindowRecord;
CWindowRecord = RECORD
    port: CGrafPort;
    windowKind: INTEGER;
    visible: BOOLEAN;
    hilited: BOOLEAN;
    goAwayFlag: BOOLEAN;
    spareFlag: BOOLEAN;
    strucRgn: RgnHandle;
    contRgn: RgnHandle;
    updateRgn: RgnHandle;
    windowDefProc: Handle;
    dataHandle: Handle;
    titleHandle: StringHandle;
    titleWidth: INTEGER;
    controlList: ControlHandle;
    nextWindow: CWindowPeek;
    windowPic: PicHandle;
    refCon: LONGINT;
    END;



PROCEDURE InitWindows;
    INLINE $A912;
PROCEDURE GetWMgrPort(VAR wPort: GrafPtr);
    INLINE $A910;
FUNCTION NewWindow(wStorage: Ptr;boundsRect: Rect;title: Str255;visible: BOOLEAN;
    theProc: INTEGER;behind: WindowPtr;goAwayFlag: BOOLEAN;refCon: LONGINT): WindowPtr;
    INLINE $A913;
FUNCTION GetNewWindow(windowID: INTEGER;wStorage: Ptr;behind: WindowPtr): WindowPtr;
    INLINE $A9BD;
PROCEDURE CloseWindow(theWindow: WindowPtr);
    INLINE $A92D;
PROCEDURE DisposeWindow(theWindow: WindowPtr);
    INLINE $A914;
PROCEDURE GetWTitle(theWindow: WindowPtr;VAR title: Str255);
    INLINE $A919;
PROCEDURE SelectWindow(theWindow: WindowPtr);
    INLINE $A91F;
PROCEDURE HideWindow(theWindow: WindowPtr);
    INLINE $A916;
PROCEDURE ShowWindow(theWindow: WindowPtr);
    INLINE $A915;
PROCEDURE ShowHide(theWindow: WindowPtr;showFlag: BOOLEAN);
    INLINE $A908;
PROCEDURE HiliteWindow(theWindow: WindowPtr;fHilite: BOOLEAN);
    INLINE $A91C;
PROCEDURE BringToFront(theWindow: WindowPtr);
    INLINE $A920;
PROCEDURE SendBehind(theWindow: WindowPtr;behindWindow: WindowPtr);
    INLINE $A921;
FUNCTION FrontWindow: WindowPtr;
    INLINE $A924;
PROCEDURE DrawGrowIcon(theWindow: WindowPtr);
    INLINE $A904;
PROCEDURE MoveWindow(theWindow: WindowPtr;hGlobal: INTEGER;vGlobal: INTEGER;
    front: BOOLEAN);
    INLINE $A91B;
PROCEDURE SizeWindow(theWindow: WindowPtr;w: INTEGER;h: INTEGER;fUpdate: BOOLEAN);
    INLINE $A91D;
PROCEDURE ZoomWindow(theWindow: WindowPtr;partCode: INTEGER;front: BOOLEAN);
    INLINE $A83A;
PROCEDURE InvalRect(badRect: Rect);
    INLINE $A928;
PROCEDURE InvalRgn(badRgn: RgnHandle);
    INLINE $A927;
PROCEDURE ValidRect(goodRect: Rect);
    INLINE $A92A;
PROCEDURE ValidRgn(goodRgn: RgnHandle);
    INLINE $A929;
PROCEDURE BeginUpdate(theWindow: WindowPtr);
    INLINE $A922;
PROCEDURE EndUpdate(theWindow: WindowPtr);
    INLINE $A923;
PROCEDURE SetWRefCon(theWindow: WindowPtr;data: LONGINT);
    INLINE $A918;
FUNCTION GetWRefCon(theWindow: WindowPtr): LONGINT;
    INLINE $A917;
PROCEDURE SetWindowPic(theWindow: WindowPtr;pic: PicHandle);
    INLINE $A92E;
FUNCTION GetWindowPic(theWindow: WindowPtr): PicHandle;
    INLINE $A92F;
FUNCTION CheckUpdate(VAR theEvent: EventRecord): BOOLEAN;
    INLINE $A911;
PROCEDURE ClipAbove(window: WindowPeek);
    INLINE $A90B;
PROCEDURE SaveOld(window: WindowPeek);
    INLINE $A90E;
PROCEDURE DrawNew(window: WindowPeek;update: BOOLEAN);
    INLINE $A90F;
PROCEDURE PaintOne(window: WindowPeek;clobberedRgn: RgnHandle);
    INLINE $A90C;
PROCEDURE PaintBehind(startWindow: WindowPeek;clobberedRgn: RgnHandle);
    INLINE $A90D;
PROCEDURE CalcVis(window: WindowPeek);
    INLINE $A909;
PROCEDURE CalcVisBehind(startWindow: WindowPeek;clobberedRgn: RgnHandle);
    INLINE $A90A;
FUNCTION GrowWindow(theWindow: WindowPtr;startPt: Point;bBox: Rect): LONGINT;
    INLINE $A92B;
FUNCTION FindWindow(thePoint: Point;VAR theWindow: WindowPtr): INTEGER;
    INLINE $A92C;
FUNCTION PinRect(theRect: Rect;thePt: Point): LONGINT;
    INLINE $A94E;
FUNCTION DragGrayRgn(theRgn: RgnHandle;startPt: Point;boundsRect: Rect;
    slopRect: Rect;axis: INTEGER;actionProc: ProcPtr): LONGINT;
    INLINE $A905;
FUNCTION TrackBox(theWindow: WindowPtr;thePt: Point;partCode: INTEGER): BOOLEAN;
    INLINE $A83B;
PROCEDURE GetCWMgrPort(VAR wMgrCPort: CGrafPtr);
    INLINE $AA48;
PROCEDURE SetWinColor(theWindow: WindowPtr;newColorTable: WCTabHandle);
    INLINE $AA41;
FUNCTION GetAuxWin(theWindow: WindowPtr;VAR awHndl: AuxWinHndl): BOOLEAN;
    INLINE $AA42;
PROCEDURE SetDeskCPat(deskPixPat: PixPatHandle);
    INLINE $AA47;
FUNCTION NewCWindow(wStorage: Ptr;boundsRect: Rect;title: Str255;visible: BOOLEAN;
    procID: INTEGER;behind: WindowPtr;goAwayFlag: BOOLEAN;refCon: LONGINT): WindowPtr;
    INLINE $AA45;
FUNCTION GetNewCWindow(windowID: INTEGER;wStorage: Ptr;behind: WindowPtr): WindowPtr;
    INLINE $AA46;
FUNCTION GetWVariant(theWindow: WindowPtr): INTEGER;
    INLINE $A80A;
FUNCTION GetGrayRgn: RgnHandle;
PROCEDURE SetWTitle(theWindow: WindowPtr;title: Str255);
    INLINE $A91A;
FUNCTION TrackGoAway(theWindow: WindowPtr;thePt: Point): BOOLEAN;
    INLINE $A91E;
PROCEDURE DragWindow(theWindow: WindowPtr;startPt: Point;boundsRect: Rect);
    INLINE $A925;

{$ENDC}    { UsingWindows }

{$IFC NOT UsingIncludes}
    END.
{$ENDC}

